/**
 * QueryThread.java
 * Created at 2017-12-26
 * Created by zhanghailin
 * Copyright (C) 2017 BROADTEXT SOFTWARE, All rights reserved.
 */
package com.broadtext.rms.monitor.thread;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;

import com.broadtext.common.repository.EntityDao;
import com.broadtext.rms.monitor.model.HistoryQueryView;

/**
 * <p>ClassName: QueryThread</p>
 * <p>Description: TODO</p>
 * <p>Author: zhanghailin</p>
 * <p>Date: 2017-12-26</p>
 */
public class QueryVolThread implements Callable<List<HistoryQueryView>> {

    private Map<String, Object> paramsMap;
    
    private EntityDao<HistoryQueryView> entityDao;
    
    
    public QueryVolThread(Map<String, Object> paramsMap, EntityDao<HistoryQueryView> entityDao ){
        this.paramsMap = paramsMap;
        this.entityDao = entityDao;
    }



    /** (non-Javadoc)
     * <p>Title: call</p>
     * <p>Description: </p>
     * @return
     * @throws Exception
     * @see java.util.concurrent.Callable#call()
     */
    @SuppressWarnings("unchecked")
    @Override
    public List<HistoryQueryView> call() throws Exception {
        //Thread.sleep(10000);
        //this.paramsMap.put("volGroupCoreNo", groupCoreNo);
        long starTime=System.currentTimeMillis();
        System.out.println("启动线程:"+paramsMap.get("packCode")+","+paramsMap.get("volGroupNo")+","+paramsMap.get("volGroupCoreNo"));
        List<HistoryQueryView> list = new ArrayList<HistoryQueryView>();
        list = entityDao.findByQuery("com.broadtext.rms.monitor.model.TtCellvoltageCurrent.getVolListByCondition", this.paramsMap);
        long endTime=System.currentTimeMillis();
        long time=endTime-starTime;
        System.out.println("结束线程:"+paramsMap.get("packCode")+","+paramsMap.get("volGroupNo")+","+paramsMap.get("volGroupCoreNo")+"[运行时间："+time+"]");
        return list;
    }

    
    
    

}
